package org.example.shop.web;

import org.example.shop.pojo.Order;
import org.example.shop.service.OrderService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 订单的服务提供者
 */
@RestController
public class OrderController implements IOrderController {
    @Resource
    private OrderService orderService;

    @Override
    public Order createOrder(@RequestBody Order order) {
        return orderService.createOrder(order.getGid(), order.getCount());
    }

    @Override
    public Order queryOrder(Long id) {
        return orderService.query(id);
    }
}
